package com.hht.toolanduilibs.wb

import android.content.Context
import com.hht.toolanduilibs.ConfigurationBean
import com.hht.toolanduilibs.CorporationType
import java.io.File


/**
 * Author:chen'hu
 * Time:2024/9/10 15:26
 * Description:This is WhiteBoardFactory
 */
class WhiteBoardFactory(
    private val configurationBean: ConfigurationBean,
    mContext: Context,
) {
    private val hhtWhiteBoard = HhtWhiteBoard(configurationBean, mContext)
    private val istWhiteBoard = IstWhiteBoard(configurationBean, mContext)
    private val lgWhiteBoard = LgWhiteBoard(configurationBean, mContext)
    private val optomaWhiteBoard = OptomaWhiteBoard(configurationBean, mContext)

    /**
     * 打开批注
     * */
    fun openAnnotation(): Boolean {

        return when (configurationBean.annotationBean.corporationType) {

            CorporationType.HHT -> hhtWhiteBoard.openAnnotation()

            CorporationType.IST -> istWhiteBoard.openAnnotation()

            CorporationType.LG -> lgWhiteBoard.openAnnotation()

            CorporationType.OPTOMA -> optomaWhiteBoard.openAnnotation()

            else -> false
        }
    }

    /**
     * 打开白板
     * */
    fun openWhiteBoard(): Boolean {

        return when (configurationBean.whiteBoardBean.corporationType) {

            CorporationType.HHT -> hhtWhiteBoard.openWhiteBoard()

            CorporationType.IST -> istWhiteBoard.openWhiteBoard()

            CorporationType.LG -> lgWhiteBoard.openWhiteBoard()

            CorporationType.OPTOMA -> optomaWhiteBoard.openWhiteBoard()

            else -> false
        }
    }


    /**
     * @param file 向白板传图片
     * */
    fun sendPicturesToWhiteBoard(file: File?): Boolean {

        return when (configurationBean.whiteBoardBean.corporationType) {

            CorporationType.HHT -> hhtWhiteBoard.sendPicturesToWhiteBoard(file)

            CorporationType.IST -> istWhiteBoard.sendPicturesToWhiteBoard(file)

            CorporationType.LG -> lgWhiteBoard.sendPicturesToWhiteBoard(file)

            CorporationType.OPTOMA -> optomaWhiteBoard.sendPicturesToWhiteBoard(file)

            else -> false
        }
    }

}